From 4261b26a53a0afa548872425c4e7bebe768468ae Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Mon, 18 Aug 2025 18:55:32 +0200 Subject: [PATCH] status/volume: Handle scroll events distinctly Stop funneling the events to the (maybe hidden) volume slider actor, and handle events directly at the volume status icon. This allows us to move it back to vertical motion, since there are no cues to make us think scroll should be horizontal here. The slider will still prefer horizontal motion. Part-of: --- js/ui/status/volume.js | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/js/ui/status/volume.js b/js/ui/status/volume.js index f966fbb85..b8f8d8fb4 100644 --- a/js/ui/status/volume.js +++ b/js/ui/status/volume.js @@ -433,12 +433,27 @@ class VolumeIndicator extends SystemIndicator { } _handleScrollEvent(item, event) { - const result = item.slider.scroll(event); - if (result === Clutter.EVENT_PROPAGATE || item.mapped) - return result; + if (event.get_flags() & Clutter.EventFlags.FLAG_POINTER_EMULATED) + return Clutter.EVENT_PROPAGATE; + + let direction = event.get_scroll_direction(); + let nSteps = 0; + if (direction === Clutter.ScrollDirection.DOWN) { + nSteps = -1; + } else if (direction === Clutter.ScrollDirection.UP) { + nSteps = 1; + } else if (direction === Clutter.ScrollDirection.SMOOTH) { + let [, dy] = event.get_scroll_delta(); + nSteps = -dy; + // Match physical direction + if (event.get_scroll_flags() & Clutter.ScrollFlags.INVERTED) + nSteps *= -1; + } + + if (item.mapped || item.slider.step(nSteps)) + item.showOSD(); - item.showOSD(); - return result; + return Clutter.EVENT_STOP; } }); -- 2.39.5